BooleanVariables
BooleanVariables[expr] gives a list of the Boolean variables in the Boolean expression expr.
BooleanVariables[bf] gives the number of Boolean variables in the BooleanFunction object bf.
Please visit the official Wolfram Language Reference for more details and examples on core symbols.